#ifndef _DEFINES_H_
#define _DEFINES_H_
#include <allegro5/allegro.h>

/*  all define switches */
#define D2IM_DEBUG
#define D2IM_ARG_CHECK
//#define D2IM_MSVC






#define FATAL_EXIT(...)    do{fprintf(stderr,"fatal error:\n");fprintf(stderr,__VA_ARGS__);fflush(stderr);exit(0);}while(0)


#ifdef  D2IM_DEBUG
#define DEBUG_MESSAGE(...)  do{fprintf(stdout,"debug message:\n");fprintf(stdout,__VA_ARGS__);fflush(stdout);}while(0)
#else
#define DEBUG_MESSAGE(...)
#endif


#ifdef  D2IM_ARG_CHECK
#define ARG_CHECK(expr) do{if(!(expr)){fprintf(stderr,"argument check fail...\n");fflush(stderr);exit(0)}while(0)
#else
#define ARG_CHECK(expr)
#endif



    /*  任何 YES/Y/TRUE/T/1 都视为TRUE  */
    /*  除此之外都为FALSE               */
#ifdef  D2IM_MSVC
#define STR_TO_BOOL(str) (stricmp((str),"YES")||stricmp((str),"Y")||stricmp((str),"TRUE")||stricmp((str),"T")||stricmp((str),"1"))
#else
#define STR_TO_BOOL(str) (strcasecmp((str),"YES")||strcasecmp((str),"Y")||strcasecmp((str),"TRUE")||strcasecmp((str),"T")||strcasecmp((str),"1"))
#endif




    /* allegro的所有struct和functions的重定义 */
#include "aldefines.h"











#ifndef _D2IM_INT_TYPE
#define _D2IM_INT_TYPE

typedef unsigned char      BYTE;
typedef unsigned short int WORD;
typedef unsigned long      DWORD;

#endif



#endif
